package com.calvin.study.observer.event;

import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationListener;
import org.springframework.context.event.ContextRefreshedEvent;
import org.springframework.stereotype.Component;

//不管是内置监听还是外部自定义监听一定要把实现ApplicationListener的类定义成一个bean才行，可以是通过注解@Component等也可以通过xml的方式去执行。
@Component
public class ListenerOne implements ApplicationListener<MyEvent> {

	@Override
	public void onApplicationEvent(MyEvent event) {
        System.out.println("ListenerOne :" + event.getSource());
	}
 
}
